Skip to content

Complete pdp implementation#2

Open
anjor wants to merge 11 commits intodata-preservation-programs:masterfrom
anjor:feature/complete-pdp-implementation
Open

Complete pdp implementation#2
anjor wants to merge 11 commits intodata-preservation-programs:masterfrom
anjor:feature/complete-pdp-implementation

Conversation

@anjor
Copy link

@anjor anjor commented Jan 27, 2026

Completes the go-synapse library with full PDP (Proof of Data Possession) functionality, enabling integration with Singularity for f41 PDP deals.

anjor added 6 commits January 27, 2026 20:10
- Extract PDPVerifier ABI from synapse-sdk reference
- Generate Go bindings using abigen for PDPVerifier contract
- Add contract address constants for Mainnet and Calibration networks
- Contract addresses:
  - Mainnet: 0xBADd0B92C1c71d02E7d520f64c0876538fa2557F
  - Calibration: 0x85e366Cf9DD2c0aE37E963d9556F5f4718d6417C

This provides the foundation for implementing direct on-chain
PDP operations including ProofSetManager.
- Add pkg/txutil package with transaction management utilities:
  - WaitForConfirmation: wait for transaction confirmations
  - EstimateGasWithBuffer: gas estimation with safety buffer
  - SendTransactionWithRetry: retry logic with exponential backoff
  - NonceManager: thread-safe nonce management
  - Retryable error detection and gas/nonce error handling

- Implement ProofSetManager in pdp/manager.go:
  - CreateProofSet: create new proof sets on-chain
  - GetProofSet: retrieve proof set details
  - AddRoots: add piece CIDs to proof sets
  - GetRoots: retrieve pieces with pagination
  - DeleteProofSet: remove proof sets
  - GetNextChallengeEpoch: query challenge schedule
  - DataSetLive: check proof set status
  - Event parsing for DataSetCreated and PiecesAdded

This completes the core PDP functionality for on-chain proof set
management and integrates with PDPVerifier contract.
- Add comprehensive tests for retry logic functions
- Test retryable error detection (nonce, gas, network errors)
- Test backoff calculation with exponential growth
- Test retry configuration defaults
- Test error wrapping utilities
- Test gas estimation validation
- Fix format string in manager.go for network type

All tests pass successfully.
- Add main README.md with:
  - Installation instructions
  - Quick start guide
  - API overview for all components
  - Configuration details
  - Contract addresses for Mainnet and Calibration
  - Development and testing instructions

- Add create-proof-set example:
  - Complete working example of creating proof sets
  - Environment variable configuration
  - Optional piece addition
  - Example output and usage instructions
  - README with detailed setup steps

The documentation provides clear guidance for users to get
started with the go-synapse SDK for PDP operations.
- Add integration test suite with build tag
- Test proof set lifecycle (create, query, check status)
- Test contract connection and verification
- Configure via environment variables:
  - CALIBRATION_RPC: RPC endpoint
  - TEST_PRIVATE_KEY: test wallet
  - TEST_LISTENER_ADDRESS: record keeper address

Run with: go test -tags=integration -v ./...

These tests verify end-to-end functionality against
Calibration testnet including contract interactions
and transaction confirmations.
Fixes staticcheck SA1012 linting error by using proper context
instead of passing nil to EstimateGasWithBuffer in tests.
Copy link

@lanzafame lanzafame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good start!

@anjor
Copy link
Author

anjor commented Jan 29, 2026

@lanzafame take a look again please?

@lanzafame
Copy link

@anjor some claude generated pr comments, but I genuinely think those are issues that need addressing.

@anjor
Copy link
Author

anjor commented Jan 31, 2026

Thanks @lanzafame!

Pushed up fixes.

Copy link
Collaborator

@parkan parkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looking pretty good, need to be more careful with error handling/looping

I'm not sure gas price discovery is ideal but we'll take it for now

@parkan
Copy link
Collaborator

parkan commented Feb 2, 2026

presumably this is still a draft PR since we're missing major functionality, or is below out of scope?

in storage:
UploadFile()
UploadData()
FindPiece()

don't exist

(totally makes sense to separate those form this layer but responding to the "complete" framing in title)

@parkan
Copy link
Collaborator

parkan commented Feb 3, 2026

the fixes look good to me, the only thing I would like to do before merging is maybe to stub out the signer interface with a dumb implementation that just takes pkey for now so the call signatures are stable (and we think through any problems with the proposed signer approach)/maybe work through the manager instantiation

@anjor
Copy link
Author

anjor commented Feb 3, 2026

@parkan ready again

Copy link
Collaborator

@parkan parkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, the simplification on nonce handling is much cleaner, signer interface can be extended for signing filecoin messages as needed (or separate iface could be defined, as desired)

overall I think this is ready to merge, the remaining plumbing should go in a separate PR

@lanzafame -- agreed? lmk if your concerns were addressed adequately/set review to approved and we'll merge

@parkan
Copy link
Collaborator

parkan commented Feb 4, 2026

once merged I'll likely update the wallet-handler branch in singularity to pull in this signer interface/extend it for agent signing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants